<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<title></title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″/>
	<link rel="stylesheet" type="text/css" href="../../css/defaultcss.css" />
	<link rel="stylesheet" type="text/css" href="../../css/amazeui.min.css" />
	<script type="text/javascript" src="../../js/jquery-1.9.1.min.js"></script>
	<script src='../../js/amazeui.min.js'></script>
	<script src='../../js/flex.js'></script>
	<script type="text/javascript" src="../../layer/layer.js"></script>
	<script type="text/javascript" src="../../js/index.js"></script>
	<link rel="stylesheet" href="../../css/weui.min.css">
	<link rel="stylesheet" href="../../css/css/stylesheets/index.css">

</head>

<body>
	<header>
		<div class="goBack">
			<img src="../../img/base/back.png" alt="返回">
		</div>
		<span class="title"> 律师服务 </span>
	</header>
	<div class="content caseList lawer_serve">
		<div class="lawer_title">
			<img src="../../img/lawer/title.png" alt="">
			<div class="title">
				我的案件
			</div>
		</div>
		<ul class="lawer_list " id="lawer_list">
		</ul>
		<div class="loading" id="loading">
			<img src="../../img/loading.gif" alt="">
		</div>
		<div class='loadData' id="loadData">
			<span class='line line1'>
			</span>
			<span>
				已经到底啦~
			</span>
			<span class='line line2'>
			</span>
		</div>
		<div class="fixed_bottom ">
			<span>
				<a href="./apply_form.html">
					申请绑定
				</a>
			</span>
			<span>
				<a href="./mine_book.html">
					我的预约
				</a>
			</span>
		</div>
	</div>

</body>

</html>

<script type="text/javascript ">
	$('.goBack').bind('click', function () {
		window.history.back()
	})
	var isLoading = true, //loading  ui
		messagePage = 1, //当前页面
		loadingState = true; //请求状态
	$('#loading').hide();
	$("#loadData").hide();
	var getData = function (pageNo) {
		if (isLoading && loadingState) {
			loadingState = false;
			HYIP.ajax({
				url: '/lawyerCase/lawyerCaseList.action',
				type: 'get',
				data: {
					pageSize: 10,
					pageNo: pageNo
				}
			}, function (data) {
				console.log(data)
				loadingState = true;
				var list = data.data.list;
				var caseList = '';
				for (var i = 0; i < list.length; i++) {
					caseList += '<li>                                                                     ' +
						'	<a href="./case_detail.html?id=' + list[i].id + '">                                        ' +
						'		<div class="case_title">                                          ' +
						list[i].caseName +
						'		</div>                                                            ' +
						'		<div class="right">                                               ' +
						'			<img src="../../img/lawer/right.png" alt="">                  ' +
						'		</div>                                                            ' +
						'	</a>                                                                  ' +
						'</li>                                                                    '
				}
				$('#lawer_list').text('').append(caseList);
				if (data.data.hasNextPage) {
					isLoading = true;
					hasNextPage = true;
					$('#loadData').hide();
				} else {
					isLoading = false;
					hasNextPage = false;
					$('#loadData').show();
					$("#loading").hide();
				}
			});
		}
	}
	getData(messagePage);
	$(window).scroll(function () {
		if (hasNextPage == true) {
			if (($("body").height() - $("body").scrollTop()) <= document.documentElement.clientHeight) {
				$("#loading").show();
				messagePage++;
				getData(messagePage);
			}
		}
	});
</script>